package bishi;

import java.util.*;

/**
 * @Author liuhaoqi
 * @Date 2020/8/24 20:43
 * @Version 1.0
 */
public class Huiding01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        char[] chars = str.toCharArray();
        System.out.println(printMaxChar(str));
    }

    public static String printMaxChar (String str) {
        if (str.length() == 1)
            return str;
        int right = 1;
        int left = 0;
        char character = str.charAt(0);
        int curnum = 1;
        int ans = 0;
        String ans_string = "";
        while (right < str.length()){
            if (str.charAt(right) == character){
                curnum++;
                right++;
                continue;
            }else {
                if (curnum > ans){
                    ans_string = character + "";
                    ans = curnum;
                }else if (curnum == ans){
                    ans_string+= ";" +  character;
                }
                curnum = 1;
                character = str.charAt(right);
                left = right;
                right++;
            }

            if (right == str.length()){
                if (curnum > ans){
                    ans_string = character + "";
                    ans = curnum;
                }else if (curnum == ans){
                    ans_string+= ";" + character;
                }
            }
        }
        if (ans_string.charAt(ans_string.length() - 1) == ';')
            return ans_string.substring(0,ans_string.length() - 1);
        else
            return ans_string;
    }

}
